{include file="public/header"/}
<div class="wrapper wrapper-content animated fadeInRight">
    <!-- Panel Other -->
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>日志列表</h5>
        </div>
        <div class="ibox-content">
            <!--搜索框开始-->
            <div class="row">
                <div class="col-sm-12">
                    <form class="layui-form" method="post" action="">
                        <div class="col-sm-3" style="padding: 0 15px 0 0;">
                            <div class="input-group">
                                <select name="key" id='key'>
                                    <option value="0">选择管理员</option>
                                    {volist name="search_user" id="v"}
                                    <option value="{$key}">{$v}</option>
                                    {/volist}
                                </select>
                                <span class="input-group-btn"> 
                                    <button type="submit" class="layui-btn" lay-submit lay-filter="search"
                                            style="border-radius: 0 3px 3px 0"><i
                                            class="fa fa-search"></i> 搜索</button>
                                </span>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
            <!--搜索框结束-->
            <div class="example-wrap">
                <div class="example">
                    <table class="layui-table"
                           lay-data="{height:'full-210',url:'operate_log',method:'post',page:true,limit:20,id:'operate_log'}"
                           lay-filter="operate_log">
                        <thead>
                        <tr>
                            <th lay-data="{title:'ID',field:'log_id',width:80,fixed:true,align:'center'}"></th>
                            <th lay-data="{title:'管理员',field:'admin_name',templet:'#admin_name',width:150}"></th>
                            <th lay-data="{title:'描述',field:'description',width:300}"></th>
                            <th lay-data="{title:'IP',field:'ip',width:120}"></th>
                            <th lay-data="{title:'地址',templet:'#address',width:200}"></th>
                            <th lay-data="{title:'状态',templet:'#status',width:100,align:'center'}"></th>
                            <th lay-data="{title:'时间',field:'add_time',width:180,align:'center'}"></th>
                            <th lay-data="{title:'操作',width:100,toolbar:'#toolbar',fixed:'right',align:'center'}"></th>
                        </tr>
                        </thead>
                        <script type="text/html" id="admin_name">
                            {{d.admin_name}}（{{d.admin_id}}）
                        </script>
                        <script type="text/html" id="address">
                            {{d.ipaddr.country}}{{d.ipaddr.area}}
                        </script>
                        <script type="text/html" id="status">
                            {{# if(d.status==1){ }}
                            操作成功
                            {{# }else{ }}
                            <font color="red">操作失败</font>
                            {{# } }}
                        </script>
                        <script type="text/html" id="toolbar">
                            <a href="javascript:;" onclick="del_log({{d.log_id}})"
                               class="layui-btn layui-btn-danger layui-btn-xs">
                                <i class="fa fa-trash-o"></i> 删除
                            </a>
                        </script>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- End Panel Other -->
</div>

<!-- 加载动画 -->
<div class="spiner-example">
    <div class="sk-spinner sk-spinner-three-bounce">
        <div class="sk-bounce1"></div>
        <div class="sk-bounce2"></div>
        <div class="sk-bounce3"></div>
    </div>
</div>

{include file="public/footer" /}

<script type="text/javascript">
    $(".spiner-example").css('display', 'none'); //数据加载完关闭动画
    var form = layui.form, table = layui.table;

    form.on('submit(search)', function (data) {
        var data = data.field;
        $.post("{:url('operate_log')}", data, function (result) {
            table.reload('operate_log', {
                where: data
            })
        });
        return false;
    });

    //删除日志
    function del_log(log_id) {
        lunhui.confirm(log_id, "{:url('del_log')}");
    }

</script>
</body>
</html>